package com.test.reggieadmin.model.fragment.flgl;

import com.test.reggieadmin.base.BaseObserver;
import com.test.reggieadmin.base.BasePresenter;
import com.test.reggieadmin.bean.BaseBean;
import com.test.reggieadmin.bean.PageCategoryBean;

public class FlglPrensenter extends BasePresenter<FlglView> {
    public FlglPrensenter(FlglView baseView) {
        super(baseView);
    }

    /**
     * 分页查询分类
     */
    public void pageCategory(long skip, int pageSize, int type) {
        addDisposable(apiServer.pageCategory(skip, pageSize), new BaseObserver<PageCategoryBean>() {
            @Override
            public void onSuccess(PageCategoryBean bean) {
                baseView.pageCategorySuccess(bean, type);
            }

            @Override
            public void onError(String msg) {
                baseView.pageCategoryError(msg);
            }
        });
    }

    /**
     * 删除分类
     *
     * @param id
     */
    public void deleteCategory(String id) {
        addDisposable(apiServer.deleteCategory(id), new BaseObserver<BaseBean>() {
            @Override
            public void onSuccess(BaseBean bean) {
                baseView.deleteCategorySuccess(bean);
            }

            @Override
            public void onError(String msg) {
                baseView.onError(msg);
            }
        });
    }
}
